import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { CacheModule } from '@nestjs/cache-manager';
import { EventEmitterModule } from '@nestjs/event-emitter';
import { ScheduleModule } from '@nestjs/schedule';
import { EventEmitterService } from './modules/proxy/event-emitter.service';
import { AppInstanceService } from './services/app-instance.service';
import { ProxyModule } from './modules/proxy/proxy.module';

@Module({
  imports: [
    CacheModule.register({
      isGlobal: true,
      ttl: 5 * 60 * 1000, // 5 minutes
    }),
    EventEmitterModule.forRoot({
      wildcard: true,
      delimiter: ':',
      maxListeners: 20,
    }),
    ScheduleModule.forRoot(),
    AppModule,
    ProxyModule,
  ],
  controllers: [AppController],
  providers: [AppService, EventEmitterService, AppInstanceService],
  exports: [EventEmitterService, AppInstanceService],
})
export class AppModule {}
